import axios from "@/api/config"

export async function getEmployeeList(data) { //用户列表获取
    const url = `/user/employees?page=${data.page}&limit=${data.limit}&account=${data.account}&section=${data.section}&shop=${data.shop}&group=${data.group}&sex=${data.sex}&jobCardID=${data.jobCardID}&occupation=${data.occupation}&post=${data.post}&postType=${data.postType}&name=${data.name}`;
    let res = await axios.get(url);
    return res.data;
}
export async function addEmployee(data) { //用户新增
    const url = '/user/employees';
    const res = await axios.post(url,data);
    return res.data;
}
export async function updateEmployee(data) { //更新职工信息
    const url = '/user/employee';
    const res = await axios.put(url,data);
    return res.data;
}
export async function getEmployeeDetail(data) {
    const url = '/user/employee/'+data;
    const res = await axios.get(url);
    return res.data;
}
export async function deleteEmployee(data) { //删除职工信息
    const url = '/user/employee/'+data;
    const res = await axios.delete(url);
    return res.data;
}
export async function getMenu() {
  const url = '/data/menu.json';
  const res = await axios.get(url);
  return res;
}
export async function getTree() {
    const url = '/config/organization';
    const res = await axios.get(url);
    return res;
}
export async function downloadTemplate() {
    const url = '/user/download/employee.csv';
    const res = await axios.get(url,{
        responseType:'blob'      //告诉服务器我们需要的响应格式
      });
    return res;
}

